package com.orhon.smartcampus.modules.schoolaffairs.nm;


import com.orhon.smartcampus.modules.schoolaffairs.entity.SchoolNews;
import com.orhon.smartcampus.modules.schoolaffairs.entity.SchoolOpinion;
import com.orhon.smartcampus.modules.schoolaffairs.gqlModel.GQLSchoolNews;
import com.orhon.smartcampus.modules.schoolaffairs.gqlModel.GQLSchoolOpinion;
import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SchoolOpinionMapper {

    SchoolOpinionMapper MAPPER = Mappers.getMapper(SchoolOpinionMapper.class);

    @Mappings({
            @Mapping(source = "id" , target = "id"),
            @Mapping(source = "sendingState" , target = "sendingState"),
            @Mapping(source = "examineState" , target = "examineState"),
            @Mapping(source = "content" , target = "content"),
            @Mapping(source = "createdAt" , target = "created_at"),
            @Mapping(source = "createdBy" , target = "created_by"),
            @Mapping(source = "updatedAt" , target = "updated_at"),
            @Mapping(source = "deletedAt" , target = "deleted_at"),
            //@Mapping(ignore = true, target = "school"),
            @Mapping(ignore = true, target = "publisher"),
            @Mapping(ignore = true, target = "receiveId"),
    })
    GQLSchoolOpinion toSchoolOpinion(SchoolOpinion entity);

    @InheritConfiguration(name = "toSchoolOpinion")
    List<GQLSchoolOpinion> toSchoolOpinionList(List<SchoolOpinion> schoolOpinion);
}
